
const setHttp = require('./request.js').setHttp;

const Topic = {
  getTopic(data) {
    return setHttp(
      `api/bubble/topic/random/${data.bubbleId}`,
      data,
      'get'
    )
  },

  setTopicFavorite(id){
    return setHttp(
      `/api/bubble/topic/${id}/favorite`,
      {id},
      'post'
    )
  },

  formRecord(detail){
    if (!detail.formId) return;
    let data = {
      "Type": detail.target.dataset.formType || 0,
      "FormId": detail.formId
    }
    
     setHttp(
      `api/bubble/topic/hit`,
       data,
      'post'
    ).then(res=>{

    },err=>{

    })
  },

  getTopicById(topicId){
    return setHttp(
      `api/bubble/topic/${topicId}`,
      { topicId},
      'get'
    )
  },

  getTopicList() {
    return setHttp(
      `api/bubble/topic/list`,
      {},
      'get'
    )
  },

  topicRecord(data){
    return setHttp(
      `api/bubble/topic/record`,
      data,
      'post'
    )
  },

  getTopicMyCenter(){
    return setHttp(
      `api/bubble/topic/ucenter`,
      {},
      'get'
    )
  }

}

module.exports = Topic